/**
 * Created by yeso on 2015/9/24.
 */
angular.module('app.service.group', ['ngResource'])

    //group
    .service('GroupService', ['$resource', function ($resource) {

        //通过name,获取good
        this.getgroupbyname = function (name) {
            var resource = $resource(localhost + "group/byname/:name");
            return resource.get({name: name});
        }
        this.addgroup = function (group, success, error) {
            var resource = $resource(localhost + "group");
            return resource.save({}, group, success, error);
        }

    }])

    //group
    .service('GroupShopService', ['$resource', function ($resource) {
        var resource = $resource(localhost + "group/shop/:groupid/:shopid");
        //
        this.addgroupshop = function (groupshop, success, error) {
            return resource.save({}, groupshop, success, error);
        }
        this.removegroupshop = function (groupid, shopid) {
            return resource.remove({groupid:groupid, shopid:shopid});
        }
    }])
;